package com.dg.gaming.server;

import java.util.*;

import com.dg.gaming.api.common.*;
import com.dg.gaming.server.data.mysql.*;
import javolution.util.*;

public class TableUser {


    private Map<Long, UserObject> users = Collections.
                                          synchronizedMap(new
            FastMap<Long, UserObject>());

    private Table table;

    private ServerTableController controller;
    private DBCurrentTable dbCurrTable;
    public TableUser(Table table, DBCurrentTable dbCurrTable,
                     ServerTableController controller) {
        this.table = table;
        this.controller = controller;
        this.dbCurrTable = dbCurrTable;

    }

    public Table getTable() {
        return table;
    }

    public ServerTableController getController() {
        return controller;
    }

    public DBCurrentTable getDbCurrTable() {
        return dbCurrTable;
    }

    public Map<Long, UserObject> getUsers() {
        return users;
    }


    public User getUser(long userId) {
        return users.get(userId).getUser();
    }

    public UserObject getUserObject(long userId) {
        return users.get(userId);
    }

    public void setTable(Table table) {
        this.table = table;
    }

    public void setUser(UserObject user) {
        users.put(user.getUser().getUserid(), user);
    }
}
